import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get('Simulate-Token') || Cookies.get(TokenKey)
}

export function isSimulate() {
  return Cookies.get('Simulate-Token')
}

export function setToken(token) {
  return Cookies.set(TokenKey, token, {expires: 1})
}

export function removeToken() {
  if (Cookies.get('Simulate-Token')) {
    Cookies.remove('Simulate-Token')
  } else {
    Cookies.remove(TokenKey)
  }
}
